<extend name="Public/base_1" />

<!-- 子導航 -->
<block name="sidebar">
    <include file="sidemenu" />
</block>

<block name="body">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    
	<div class="main-title cf">
		<h2>
		留言板	
		</h2>
	</div>
	<!-- 標簽頁導航 -->
<div class="tab-wrap">
<!--	<ul class="tab-nav nav">
		<volist name=":parse_config_attr($model['field_group'])" id="group">
			<li data-tab="tab{$key}" <eq name="key" value="1">class="current"</eq>><a href="javascript:void(0);">{$group}</a></li>
		</volist>
	</ul>-->
	<div class="tab-content">
    <style>
table{ width:100%; border-collapse:collapse; font-size:13px; background: #fff; margin-bottom: 10px}
table tr{ width:100%; height:50px;}
table tr td{ border:1px #ccc solid; padding-left:15px;}
.text1{ width:70%; height:50px; border:0; padding-left:10px; line-height:50px;}
.text2{ width:70%; height:90px; border:0; vertical-align:middle; padding:10px; line-height:15px; overflow: hidden; font-size: 12px}
</style>
              <table  id="printContent">

  <tr>
    <td>聯繫人：<input type="text" class="text1" value="{$data.title}"></td>
    <td colspan="2">電話：<input type="text" class="text1" value='{$data.tel}'></td>
  </tr>
  <tr>
    <td colspan="3">郵箱：<input type="text" class="text1" value="{$data.email}"></td>
  </tr>
  <tr>
    <td colspan="3">描述：<textarea class="text2" >{$data.description}</textarea></td>
  </tr>
    <td colspan="3" style="border-top:0;">發表時間：<input type="text" class="text1" value="{$data.create_time|date='Y-m-d',###}"></td>
  </tr>
  
</table>     
		<div class="form-item cf">
			<a class="btn btn-return" href="{$Think.cookie.__forward__}">返 回</a>
			<if condition="C('OPEN_DRAFTBOX') and (ACTION_NAME eq 'add' or $data['status'] eq 3)">
			</if>
			<input type="hidden" name="id" value="{$data.id|default=''}"/>
			<input type="hidden" name="pid" value="{$data.pid|default=''}"/>
			<input type="hidden" name="model_id" value="{$data.model_id|default=''}"/>
			<input type="hidden" name="category_id" value="{$data.category_id|default=''}">
		</div>
	</div>
</div>
</block>

<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">

Think.setValue("type", {$data.type|default='""'});
Think.setValue("display", {$data.display|default=0});



$(function(){
    $('.time').datetimepicker({
        format: 'yyyy-mm-dd hh:ii',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });
    showTab();

	<if condition="C('OPEN_DRAFTBOX') and (ACTION_NAME eq 'add' or $data['status'] eq 3)">
	//保存草稿
	var interval;
	$('#autoSave').click(function(){
        var target_form = $(this).attr('target-form');
        var target = $(this).attr('url')
        var form = $('.'+target_form);
        var query = form.serialize();
        var that = this;

        $(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
        $.post(target,query).success(function(data){
            if (data.status==1) {
                updateAlert(data.info ,'alert-success');
                $('input[name=id]').val(data.data.id);
            }else{
                updateAlert(data.info);
            }
            setTimeout(function(){
                $('#top-alert').find('button').click();
                $(that).removeClass('disabled').prop('disabled',false);
            },1500);
        })

        //重新開始定時器
        clearInterval(interval);
        autoSaveDraft();
        return false;
    });

	//Ctrl+S保存草稿
	$('body').keydown(function(e){
		if(e.ctrlKey && e.which == 83){
			$('#autoSave').click();
			return false;
		}
	});

	//每隔壹段時間保存草稿
	function autoSaveDraft(){
		interval = setInterval(function(){
			//只有基礎信息填寫了，才會觸發
			var title = $('input[name=title]').val();
			var name = $('input[name=name]').val();
			var des = $('textarea[name=description]').val();
			if(title != '' || name != '' || des != ''){
				$('#autoSave').click();
			}
		}, 1000*parseInt({:C('DRAFT_AOTOSAVE_INTERVAL')}));
	}
	autoSaveDraft();

	</if>

});
</script>

</block>
